Skip to content

fix: let the doc bottom navigation wrap on narrow viewports - #2488

Open
bilashcse wants to merge 7 commits into
expressjs:mainfrom
bilashcse:fix/doc-nav-wrap-narrow-screens
Open

fix: let the doc bottom navigation wrap on narrow viewports#2488
bilashcse wants to merge 7 commits into
expressjs:mainfrom
bilashcse:fix/doc-nav-wrap-narrow-screens

Conversation

@bilashcse

Copy link
Copy Markdown

Problem

On narrow viewports the previous/next links at the bottom of a doc page cannot fit on one line, and because .doc-nav is display: flex with no flex-wrap, the row overflows instead of wrapping.

Measured on the live site at a 400px wide viewport on /en/guide/migrating-4/: .doc-nav is 340px wide with a scrollWidth of 399px, so the Next link is clipped. The same thing happens around 950px, where both sidebars are visible and the content column is only about 250px wide.

Closes #2486.

Fix

Add flex-wrap: wrap-reverse to .doc-nav, the first option suggested in the issue. When the two links cannot share a line, Next wraps onto its own line above Previous, which keeps the forward link closest to the end of the content.

With the rule applied, the overflow measured above goes from 59px to 0px. At a 1314px viewport nothing changes: both links stay on one line at the same offsets.

Tests

tests/e2e/doc-bottom-nav.spec.ts covers three things on /en/guide/migrating-4/: .doc-nav does not overflow at a 400px viewport, Next sits above Previous at that width, and both links stay side by side on one line at 1400px. The first two assertions fail against main today.

A note on verification: the Playwright job runs against the PR deploy preview, so I could not run the new spec from my fork. The numbers above come from measuring the elements in a browser on the live site with the rule injected, and the CI run on this PR should exercise the spec for real.

Docs

docs/design-system.md gains a short Doc Bottom Navigation section describing the wrapping behaviour, including a note that DOM order stays previous-then-next so keyboard and screen reader order is unaffected.

Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
@bilashcse
bilashcse requested a review from a team as a code owner August 12, 2026 04:27
@netlify

netlify Bot commented Aug 12, 2026

Copy link
Copy Markdown

Deploy Preview for expressjscom-preview ready!

Name Link
🔨 Latest commit 954257f
🔍 Latest deploy log https://app.netlify.com/projects/expressjscom-preview/deploys/6a7c0c8074dc030008ad8c76
😎 Deploy Preview https://deploy-preview-2488--expressjscom-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 97 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
@bilashcse

Copy link
Copy Markdown
Author

CI results are in, so the verification note in the description can be treated as resolved: Playwright now runs 57 tests (48 before this PR, plus the 3 new ones on chromium, firefox and webkit) and all 57 pass against the deploy preview. lint and build are green too.

The extra commits after the first three are only lint fixes: a trailing blank line prettier did not want, and two rewordings because cspell's dictionary does not have "viewports". Happy to squash or to add the word to project-words.txt instead if you would prefer that.

The linkChecker job failed with 10 request timeouts, all for the NVD advisory link in the v5 release blog post (one per locale), and 0 real errors. Ignore the domain like the other hosts here that rate limit or block automated requests.

Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Previous/next navigation can be too wide on small screens

1 participant